home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / GNU / GNUPLOTsrc.lha / term / qms.trm < prev    next >
Encoding:
Text File  |  1996-01-22  |  5.3 KB  |  210 lines

  1. /*
  2.  * $Id: qms.trm,v 1.6 1995/12/20 21:48:10 drd Exp $
  3.  *
  4.  */
  5.  
  6. /* GNUPLOT - qms.trm */
  7. /*
  8.  * Copyright (C) 1990 - 1993   
  9.  *
  10.  * Permission to use, copy, and distribute this software and its
  11.  * documentation for any purpose with or without fee is hereby granted, 
  12.  * provided that the above copyright notice appear in all copies and 
  13.  * that both that copyright notice and this permission notice appear 
  14.  * in supporting documentation.
  15.  *
  16.  * Permission to modify the software is granted, but not the right to
  17.  * distribute the modified code.  Modifications are to be distributed 
  18.  * as patches to released version.
  19.  *  
  20.  * This software  is provided "as is" without express or implied warranty.
  21.  * 
  22.  * This file is included by ../term.c.
  23.  *
  24.  * This terminal driver supports:
  25.  *  QMS laser printers
  26.  *
  27.  * AUTHORS
  28.  *  Colin Kelley, Thomas Williams, Russell Lang
  29.  * 
  30.  * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  31.  * 
  32.  */
  33. /*
  34.  * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
  35.  */
  36.  
  37. #ifndef GOT_DRIVER_H
  38. #include "driver.h"
  39. #endif
  40.  
  41. #ifdef TERM_REGISTER
  42. register_term(qms)
  43. #endif
  44.  
  45. #ifdef TERM_PROTO
  46. TERM_PUBLIC void QMS_init __P((void));
  47. TERM_PUBLIC void QMS_graphics __P((void));
  48. TERM_PUBLIC void QMS_text __P((void));
  49. TERM_PUBLIC void QMS_linetype __P((int linetype));
  50. TERM_PUBLIC void QMS_move __P((unsigned int x, unsigned int y));
  51. TERM_PUBLIC void QMS_vector __P((unsigned int x2, unsigned int y2));
  52. TERM_PUBLIC void QMS_put_text __P((unsigned int x, unsigned int y, char str[]));
  53. TERM_PUBLIC void QMS_reset __P((void));
  54.  
  55. #define QMS_XMAX 9000
  56. #define QMS_YMAX 6000
  57.  
  58. #define QMS_XLAST (QMS_XMAX - 1)
  59. #define QMS_YLAST (QMS_YMAX - 1)
  60.  
  61. #define QMS_VCHAR        120
  62. #define QMS_HCHAR        70
  63. #define QMS_VTIC        70
  64. #define QMS_HTIC        70
  65. #endif /* TERM_PROTO */
  66.  
  67. #ifndef TERM_PROTO_ONLY
  68. #ifdef TERM_BODY
  69. int qms_line = 0;    /* to remember current line type */
  70.  
  71. TERM_PUBLIC void QMS_init()
  72. {
  73. /* This was just ^IOL, but at Rutgers at least we need some more stuff */
  74.   fprintf(outfile,"^PY^-\n^IOL\n^ISYNTAX00000^F^IB11000^IJ00000^IT00000\n");
  75. /*                 ^ QUIC on    ^set defaults  ^ set botttom,top,left margins
  76.                           ^landscape         ^free format   */
  77. /* set defaults are: implicit decimal point, units in inches, 
  78.    numbers left justified, units in 1/1000 inch, do not ignore spaces */
  79. /* margins are in 1/1000 inch units */
  80. }
  81.  
  82.  
  83. TERM_PUBLIC void QMS_graphics()
  84. {
  85.     fprintf(outfile,"^IGV\n");
  86. /*                     ^enter graphics vector mode */
  87. }
  88.  
  89.  
  90.  
  91. TERM_PUBLIC void QMS_text()
  92. {
  93. /* added ^-, because ^, after an ^I command doesn't actually print a page */
  94. /* Did anybody try this code out?  [uhh...-cdk] */
  95.     fprintf(outfile,"^IGE\n^-^,");
  96. /*                     ^exit graphics vector mode
  97.                            ^pass terminator
  98.                              ^print page  */
  99. }
  100.  
  101.  
  102. TERM_PUBLIC void QMS_linetype(linetype)
  103. int linetype;
  104. {
  105. static int width[2+9] = {7, 3, 3, 3, 3, 5, 5, 5, 7, 7, 7};
  106. static int type[2+9] =  {0, 1, 0, 2, 3, 0, 2, 3, 0, 2, 3};
  107. /*
  108.  * I don't know about Villanova, but on our printer, using ^V without
  109.  * previously setting up a pattern crashes the microcode.
  110.  * [nope, doesn't crash here. -cdk]
  111.  * [it generates a controller error here on dotted lines. - rjl]
  112.  */
  113. /* Code to define patterns added by rjl
  114.  * According to the manual it should work - but it doesn't
  115.  */
  116.     qms_line = linetype;
  117.     if (linetype >= 9)
  118.         linetype %= 9;
  119.     fprintf(outfile,"^PW%02d\n",width[linetype+2]); 
  120. /*                     ^width in dots */
  121.     switch (type[linetype+2]) {
  122.         case 1 :    /* short dash */
  123.             fprintf(outfile,"^PV102025^G\n^V1\n");
  124. /* ^PV = define pattern vector, 1 = pattern number,
  125.    02 = number of pen downs and ups, 025 = .025" length of ups/downs */
  126.             break;
  127.         case 2 :    /* medium dash */
  128.             fprintf(outfile,"^PV202050^G\n^V2\n");
  129.             break;
  130.         case 3 :    /* long dash */
  131.             fprintf(outfile,"^PV302100^G\n^V3\n");
  132.             break;
  133.         default:
  134.         case 0 :
  135.             fprintf(outfile,"^V0\n");
  136.             break;
  137.     }
  138. }
  139.  
  140.  
  141. TERM_PUBLIC void QMS_move(x,y)
  142. unsigned int x,y;
  143. {
  144.     fprintf(outfile,"^U%05d:%05d\n", 1000 + x, QMS_YLAST + 1000 - y);
  145. /*                     ^pen up vector*/
  146. }
  147.  
  148.  
  149. TERM_PUBLIC void QMS_vector(x2,y2)
  150. unsigned int x2,y2;
  151. {
  152.     fprintf(outfile,"^D%05d:%05d\n", 1000 + x2, QMS_YLAST + 1000 - y2);
  153. /*                     ^pen down vector*/
  154. }
  155.  
  156.  
  157. TERM_PUBLIC void QMS_put_text(x,y,str)
  158. unsigned int x,y;
  159. char str[];
  160. {
  161. char ch;
  162.     QMS_move(x,y + QMS_VCHAR/3);
  163.     fputs("^IGE\n",outfile);
  164.     ch = *str++;
  165.     while(ch!='\0') {
  166.         if (ch=='^')
  167.             putc('^',outfile);
  168.         putc(ch,outfile);
  169.         ch = *str++;
  170.     }
  171.     fputs("\n^IGV\n",outfile);
  172.     QMS_linetype(qms_line); /* restore line type */
  173. }
  174.  
  175.  
  176. TERM_PUBLIC void QMS_reset()
  177. {
  178.     fprintf(outfile,"^PN^-\n");
  179. /*                     ^QUIC off*/
  180. }
  181.  
  182. #endif /* TERM_BODY */
  183.  
  184. #ifdef TERM_TABLE
  185.  
  186. TERM_TABLE_START(qms_driver)
  187.     "qms", "QMS/QUIC Laser printer (also Talaris 1200 and others)",
  188.        QMS_XMAX,QMS_YMAX, QMS_VCHAR, QMS_HCHAR, 
  189.        QMS_VTIC, QMS_HTIC, options_null, QMS_init,QMS_reset, 
  190.        QMS_text, null_scale, QMS_graphics, QMS_move, QMS_vector,
  191.        QMS_linetype,QMS_put_text, null_text_angle, 
  192.        null_justify_text, line_and_point, do_arrow, set_font_null
  193. TERM_TABLE_END(qms_driver)
  194.  
  195. #undef LAST_TERM
  196. #define LAST_TERM qms_driver
  197.  
  198. #endif /* TERM_TABLE */
  199. #endif /* TERM_PROTO_ONLY */
  200.  
  201. /*
  202.  * NAME: qms
  203.  *
  204.  * OPTIONS: none
  205.  *
  206.  * SUPPORTS: QMS/QUIC Laser printer (also Talaris 1200 and others)
  207.  *
  208.  * Further Info: none. Who was Talaris? 
  209.  *
  210.  */